﻿namespace pos.entity
{
    using System;
   using System.Collections;
    /// <summary>
    /// consts 的摘要说明
    /// </summary>
    public class consts
    {
        public const double double_min = -999999999;
        public const double double_max = 999999999;
        public const int int_min = -999999;
        public const int int_max =  999999;
        public const long long_min = -9999999999;
        public const long long_max = 9999999999;
        public const string datetime_min = "100-1-1";
        public static long cashboxNO=1;
        public static string userID = "";
        public static string memberSeqID = "";
        public static string groupID = "";

        
      /*  public static string SaleNotesTitle1 = "如海超市";
        public static string SaleNotesTitle2 = "        --坦直店";
        public static string SaleNotesAdvertise1 = "";
        public static string SaleNotesAdvertise2 = "";
      */
        public static Hashtable SettingPara = new Hashtable();
        public static string getPara(string name)
        {
            Object t=SettingPara[name];
            if (t == null)
                return "";
            else
                return t.ToString();
        }
        
        public consts()
        {
            //
            // TODO: 在此处添加构造函数逻辑
            //
        }

        #region   半全角互换
        ///   <summary>   
        ///   转全角的函数(SBC   case)   
        ///   </summary>   
        ///   <param   name="input">任意字符串</param>   
        ///   <returns>全角字符串</returns>   
        ///<remarks>   
        ///全角空格为12288，半角空格为32   
        ///其他字符半角(33-126)与全角(65281-65374)的对应关系是：均相差65248   
        ///</remarks>                   
        public static string ToSBC(string input)
        {
            //半角转全角：   
            char[] c = input.ToCharArray();
            for (int i = 0; i < c.Length; i++)
            {
                if (c[i] == 32)
                {
                    c[i] = (char)12288;
                    continue;
                }
                if (c[i] < 127 && c[i] > 32)
                {
                    c[i] = (char)(c[i] + 65248);
                }
            }
            return new string(c);
        }

        ///   <summary>   
        ///   转半角的函数(DBC   case)   
        ///   </summary>   
        ///   <param   name="input">任意字符串</param>   
        ///   <returns>半角字符串</returns>   
        ///<remarks>   
        ///全角空格为12288，半角空格为32(此处不必转空格)   
        ///其他字符半角(33-126)与全角(65281-65374)的对应关系是：均相差65248   
        ///</remarks>   
        public static string ToDBC(string input)
        {
            char[] c = input.ToCharArray();
            for (int i = 0; i < c.Length; i++)
            {
                if (c[i] == 12288)
                {
                    c[i] = (char)32;
                    continue;
                }
                if (c[i] > 65280 && c[i] < 65375)
                {
                    c[i] = (char)(c[i] - 65248);
                }
            }
            return new string(c);
        }
        #endregion

    }
}
